package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetProductNumOfActivityOrdersBean;
import com.ymatou.query.trading.api.service.GetProductNumOfActivityOrdersCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.utils.constant.ECode;

/**
 * 获取当前买家已购买的某个具体活动中商品的数量（暂用于码头app） FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetProductNumOfActivityOrders {

	private static GetProductNumOfActivityOrdersBean getproductnumofactivityordersbean;
	private static GetProductNumOfActivityOrdersCall getproductnumofactivityorderscall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取当前买家已购买的某个具体活动中商品的数量（暂用于码头app）");
	}

	@Before
	public void caseUp() {

		getproductnumofactivityordersbean = new GetProductNumOfActivityOrdersBean();
		getproductnumofactivityorderscall = new GetProductNumOfActivityOrdersCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getproductnumofactivityorderscall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductNumOfActivityOrders_001() {
		Logger.start(true,"获取当前买家已购买的某个具体活动中商品的数量（暂用于码头app）成功");
		try {
			// 参数
			getproductnumofactivityordersbean.setActivityId(150);
			getproductnumofactivityordersbean.setBuyerId(1113);
			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(4);
			getproductnumofactivityordersbean.setOrderStatusList(list);
			// 发送请求
			getproductnumofactivityorderscall.setData(getproductnumofactivityordersbean);
			getproductnumofactivityorderscall.callService();
			Logger.comment("getproductnumofactivityorderscall send:"
					+ getproductnumofactivityorderscall.getEntityString());
			Logger.comment("getproductnumofactivityorderscall response:"
					+ getproductnumofactivityorderscall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getproductnumofactivityorderscall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getproductnumofactivityorderscall.getMsg(), "验证Msg");
			Logger.verifyEquals(true, getproductnumofactivityorderscall.getActivityProductNum() > 0, "验证查询结果");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}